<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>语言相关的列表格式化构造器IntlListFormat</title>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
  </style>
</head>

<body>
  <div></div>
</body>
<script>
  "use strict"; {
    const vehicles = ['Motorcycle', 'Bus', 'Car'];

    const formatter = new Intl.ListFormat('en', { style: 'long', type: 'conjunction' });
    console.log(formatter.format(vehicles));
    // expected output: "Motorcycle, Bus, and Car"

    const formatter2 = new Intl.ListFormat('de', { style: 'short', type: 'disjunction' });
    console.log(formatter2.format(vehicles));
    // expected output: "Motorcycle, Bus oder Car"

    const formatter3 = new Intl.ListFormat('en', { style: 'narrow', type: 'unit' });
    console.log(formatter3.format(vehicles));
    // expected output: "Motorcycle Bus Car"
  };
</script>

</html>